package com.im.entity;
import com.baomidou.mybatisplus.annotation.*;

import java.time.LocalDateTime;
import java.util.Date;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.io.Serializable;
/**
 * @author xainsir
 * @since 2025-02-14
 */
@Data
@Schema
@TableName("im_session")
public class ImSession implements Serializable {

    private static final long serialVersionUID=1L;

    // 18位永不重复ID
    @TableField("session_id")
    @Schema(description = "会话id")
    private Long sessionId;

    @Schema(description = "主键id")
    @TableId(value = "id", type = IdType.ASSIGN_ID)
    private Long id;

    @TableField("user_id")
    @Schema(description = "所属用户ID")
    private Integer userId;

    @TableField("target_id")
    @Schema(description = "目标对象ID")
    private Integer targetId;

    @TableField("type")
    @Schema(description = "会话类型(1:私聊, 2:群聊)")
    private Integer type;

    @TableField("last_message_id")
    @Schema(description = "最新一条消息摘要")
    private Long lastMessageId;

    @TableField("last_login_ip")
    @Schema(description = "最后登录IP")
    private String lastLoginIp;

    @TableField(fill = FieldFill.INSERT)
    @Schema(description = "会话创建时间")
    private LocalDateTime createTime; // 自动填充


    @TableField(fill = FieldFill.INSERT_UPDATE)
    @Schema(description = "会话更新时间")
    private LocalDateTime updateTime; // 自动填充
}